fn rs_main1(s: String) -> bool {
  let mut stack: Vec<char> = Vec::new();
  let chars: Vec<char> = s.chars().collect();
  let chars_len = chars.len();
  if chars_len == 0 { return true; }
  for i in 0..chars_len {
    if chars[i] == '(' {
      stack.push(')');
    } else if chars[i] == '[' {
      stack.push(']');
    } else if chars[i] == '{' {
      stack.push('}');
    } else if stack.is_empty()|| chars[i] != stack.pop().unwrap() {
      return false;
    }
  }
  return stack.is_empty();
}


fn main() {
  println!("{}", rs_main1(String::from("()")));
  println!("{}", rs_main1(String::from("()[]{}")));
  println!("{}", rs_main1(String::from("(]")));
  println!("{}", rs_main1(String::from("([)]")));
  println!("{}", rs_main1(String::from("{[]}")));
}
